<%-- 
    Document   : formmaster
    Created on : Nov 9, 2012, 2:02:38 AM
    Author     : marifnst
--%>

<%@page import="java.util.Map"%>
<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath()%>/res/jquery-ui-1.9.1.custom/css/smoothness/jquery-ui-1.9.1.custom.min.css" />
        <link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath()%>/res/jqgrid/css/ui.jqgrid.css" />
        <script type="text/javascript" src="<%=request.getContextPath()%>/res/gridfunc.js"></script>
        <script src="<%=request.getContextPath()%>/res/jqgrid/js/jquery-1.7.2.min.js" type="text/javascript"></script>
        <script src="<%=request.getContextPath()%>/res/jquery-ui-1.9.1.custom/js/jquery-ui-1.9.1.custom.min.js" type="text/javascript"></script>
        <script src="<%=request.getContextPath()%>/res/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
        <script src="<%=request.getContextPath()%>/res/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>

        <script type="text/javascript">
            jQuery(document).ready(function(){  
                jQuery.ajax({
                    url : '<%=request.getContextPath()%>/form/getGrid?parent=<%=request.getParameter("parent")%>',
                    type: 'post',
                    data: "",          
                    dataType: "json",
                    success : function (result) {    
                        loadGridData(jQuery("#grid"), result);
                        jQuery("#keySearch").html(result.keySearch);
                    }                    
                });                                        
                
                jQuery("#dateSearch").datepicker({ dateFormat: "yy-mm-dd" });                
                jQuery("#buttonSearch").button();                
                
                var exportDialog = jQuery("#exportDialog").load("<%=request.getContextPath()%>/formexporter.jsp").dialog(
                {
                    autoOpen: false,
                    title : 'Export',                    
                    modal:true,
                    hide: 'fold',
                    show: 'blind'
                });
                jQuery("#buttonExport").button().click(function( event ) {
                    exportDialog.dialog('open');
                });
                
                var importDialog = jQuery("#importDialog").load("<%=request.getContextPath()%>/formimporter.jsp").dialog(
                {
                    autoOpen: false,
                    title : 'Import',
                    modal:true,
                    hide: 'fold',
                    show: 'blind'
                });
                jQuery("#buttonImport").button().click(function( event ) {
                    importDialog.dialog('open');
                });
                
            });                                                                
        </script>
    </head>
    <body>
        <table>
            <tr>
                <td>Search : </td>
                <td><div id="keySearch" /></td>
                <td><input type="search" id="keySearchValue" /></td>
                <td><input type="submit" id="buttonSearch" value="Search" onclick="searchPro(jQuery('#grid').jqGrid(),
                    jQuery('#keySearch').find('option:selected').text(),
                    jQuery('#keySearchValue').val())" /></td>
                <td><input type="submit" id="buttonExport" value="Export" /></td>
                <td><input type="submit" id="buttonImport" value="Import" /></td>
            </tr>
        </table>
        <div id="jqgrid">
            <table id="grid"></table>
            <div id="gridpager"></div>
        </div>
        <div id="exportDialog" />
        <div id="importDialog" />
    </body>
</html>
